#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
const int maxn = 100 + 10;

ll a[maxn][maxn], dp[maxn][maxn], b[maxn], n, m;


int main() {
    while (cin >> n) {
        m = n;
        memset(a, 0, sizeof(a));
        memset(dp, 0, sizeof(dp));
        memset(b, 0, sizeof(b));
        for (int i = 0; i < n; i++)for (int j = 0; j < m; j++)cin >> a[i][j];
        for (int j = 0; j < m; j++)
            dp[0][j] = a[0][j];
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < m; j++) {

                dp[i][j] = dp[i - 1][j] + a[i][j];
            }
        }
        ll target = 0;
        for (int i = 0; i < n; i++)
            for (int j = i; j < n; j++) {
                for (int k = 0; k < m; k++) {
                    if (i == 0)
                        b[k] = dp[j][k];
                    else
                        b[k] = dp[j][k] - dp[i-1][k];
                }

                ll best = INT_MIN, sum = 0;
                for (int k = 0; k < m; k++) {
                    sum += b[k];
                    best = max(sum, best);
                }
                target = max(best, target);
            }
        cout << target << endl;
    }

    return 0;
}
